package com.yuhs.zixing.study.design.pattern.dp002.structural.s007.proxy.p006;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @description:
 * @author: yuhs
 * @date: 2022/5/2 9:18 PM
 */
public class MyInvocationHandler006 implements InvocationHandler {
    //被代理的对象
    private Object target = null;

    //通过构造函数传递一个对象
    public MyInvocationHandler006(Object _obj) {
        this.target = _obj;
    }

    //代理方法
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        //执行被代理的方法
        return method.invoke(this.target, args);
    }

}
